#include "process.h"
#define style '#'

void Flushprocess(double total,double current)
{
    char buffer[101];
    const char* str = "|/-\\";
    int len = strlen(str);

    double rate = current*100.0/total;
    int num = (int)rate;
    memset(buffer,0,sizeof(buffer));
    
    int i = 0;
    for(; i<num; i++)
    {
        buffer[i] = style;
    }
    printf("[%-100s][%.1f][%c]\r",buffer,rate,str[num%len]);
    fflush(stdout);
}

